From 60319eecb8a101ff6425de95df7f1229074191f6 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc kop@karlpinc.com" Date: Wed, 5 Aug 2026 16:24:05 +0000 Subject: [PATCH] Add example query to SPECIES_PRESENT doc --- doc/src/tables/species_present.m4 | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/doc/src/tables/species_present.m4 b/doc/src/tables/species_present.m4 index d1c7a0c..9587fd6 100644 --- a/doc/src/tables/species_present.m4 +++ b/doc/src/tables/species_present.m4 @@ -29,15 +29,35 @@ SPECIES_PRESENT |SPECIES_PRESENT_summary| -.. sidebar:: - - |OBS helpful| - The related |EVENTS| row must must be one that records the presence of other species; the |EVENTS| row with an |EVENTS.EID| value that matches the SPECIES_PRESENT row's |SPECIES_PRESENT.EID| value must have an |EVENTS|.\ |EVENTS.Behavior| value of ``sdb_other_species``. +The |OBS| view is useful when querying SPECIES_PRESENT. + +.. code-block:: sql + :caption: + Using OBS to provide a more complete picture of other species present + + SELECT obs.wid, obs.type + , obs.eid + , obs.date + , obs.animid AS focal + , obs.commid + , obs.start + , obs.stop + , species_present.species + , obs.notes + , obs.event_notes + FROM obs + JOIN species_present + ON (species_present.eid = obs.eid) + WHERE obs.behavior = 'sdb_other_species' + ORDER BY obs.animid, obs.date, obs.start, obs.stop + , obs.eid; + + .. contents:: :depth: 2 -- 2.34.1